<template>
  <div>

  <p>学生年龄和为{{agess}}</p>
  </div>
</template>

<script>
export default {
  data () {
    return {
      arr : [{
    name: "小明",
    age: 18
  }, {
    name: "小花",
    age: 25
  }, {
    name: "小爱",
    age: 21
  }],
    }
  },
  computed: {
    agess(){
    return  this.arr.reduce((a,b)=>{
         a +=  b.age
         return a
       },0)
    }
  }
  
}
</script>

<style>

</style>